package com.dy.service;

import javax.servlet.ServletException;
import javax.servlet.SingleThreadModel;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @Auther: dy
 * @Date: 2022/3/21 - 03 - 21 - 12:47
 * @Description: ${PACKAGE_NAME}
 * @version: 1.0
 */
//@WebServlet(name = "TestServlet",urlPatterns = "testServlet")
public class TestServlet extends HttpServlet implements SingleThreadModel {
    private static Integer count = 0;
    @Override
    public void init() throws ServletException {
        count ++;
        System.out.println("初始化servlet"+count);
    }

    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    @Override
    public void destroy() {
        System.out.println("销毁servlet"+count);
    }
}
